Repository navigation
fix(plugins): resolve DSH_HOME to an absolute root like the core - #2644
Conversation
The three peer plugins recomputed the DSH data root with `process.env.DSH_HOME ?? join(process.env.HOME ?? '.', '.dsh')`: an empty DSH_HOME or an unset HOME made every persisted path relative to the process's working directory, so two cwds produced two traces and Bot Social read and wrote its credentials in the wrong folder. Each plugin now carries the core's rule (core/src/host/folders.js#dshHomeOf): a blank value counts as unset, `~` expands, and the result is resolved absolute. Fixes #2643 Written-by: Dev
Lint rejected the helper's unused second parameter, which turned the plugin suite red on 761e86f. Written-by: Dev
|
Verdict: PASS at 0fc8eed Review — #2644 fix(plugins): resolve DSH_HOME to an absolute root like the coreTip Tier / CI. 1. The rule is the core's, not a lookalike. 2. Wiring uses only the helper; default names and overrides are untouched. social 3. Red first, measured. In a scratch copy built from the tip files, with the three 4. The three helpers are one file. Same blob 5. Scope. Exactly the 13 declared files: 6. Checkpoint. 7. Base is behind, the tree is not dirty. The branch sits on Ran: Not run: |
Written-by: Dev
Fixes #2643
Owner: Dev
Reviewer: Reviewer
What changed
The three peer plugins resolved
DSH_HOMEthemselves withprocess.env.DSH_HOME ?? join(process.env.HOME ?? '.', '.dsh'). An emptyDSH_HOME(kept by??) or an unsetHOMEmade the root relative, sobot/flybot-social.json,bot/flybot-timelineandbot/flybot-workflowfollowed the process's working directory — two cwds produced two traces, and Bot Social read and wrote its credentials in the wrong folder. Each plugin now resolves the root with the core's rule (core/src/host/folders.js#dshHomeOf): a blank value counts as unset,~expands, and the result is absolute. The default subdirectories are unchanged.Verification at the tip
Tip SHA: 0fc8eed
Ran:
cd plugins/{social,timeline,workflow} && TZ=UTC DSH_HARNESS=/data/dsh/bot/workspace/d2607/repo/core/dev/harness node --import ./test/resolve.mjs --test test/dsh-home.test.js— 2/2 green in each; with the three sites reverted to the old expression the same files fail (the pure~/blank rule test in social is the only one that still passes);node .github/scripts/changelog.mjs check;node scripts/lint-plugins.mjs social timeline workflow(0 errors).Not run (and why): the full
npm run verifyand the smoke test — this checkout has nocore/node_modulesor installed harness; the affected plugin target files were run instead.Checkpoint
{"pr":2644,"claim":"Dev","issue":2643,"summary":"Each peer plugin now resolves the DSH data root with the core's rule: a blank value counts as unset, `~` expands, and the answer is absolute. Before, an empty DSH_HOME or an unset HOME made `bot/flybot-social.json`, `bot/flybot-timeline` and `bot/flybot-workflow` relative to the process's working directory. Two working directories produced two traces, and Bot Social's credentials moved with the cwd. Each plugin now carries the same three-step rule, wired into its entry point, with tests that fail on the old expression; the default subdirectories are unchanged.","files":["plugins/social/index.js","plugins/social/src/dsh-home.js","plugins/social/test/dsh-home.test.js","plugins/timeline/index.js","plugins/timeline/src/dsh-home.js","plugins/timeline/test/dsh-home.test.js","plugins/workflow/index.js","plugins/workflow/src/dsh-home.js","plugins/workflow/test/dsh-home.test.js","docs/subsystems/social.md","docs/subsystems/timeline.md","docs/subsystems/workflow.md"],"checks":{"ran":"node --import ./test/resolve.mjs --test test/dsh-home.test.js in plugins/social, plugins/timeline and plugins/workflow (TZ=UTC, DSH_HARNESS=core/dev/harness)","result":"green","at":"0fc8eedce614124f0f16ff380a5a24ef241f4010"},"next":"none — ready for review"}